{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import arctan,sin,cos,tan\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import cv2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "#相机参数\n",
    "#x0 y0:主点\n",
    "class camera:\n",
    "    def __init__(self,m,n, h):\n",
    "        self.m=m  # 像片宽\n",
    "        self.n=n  # 像片高\n",
    "        self.h = h  # 镜头离地高度\n",
    "        root=r\"C:\\Users\\Lenovo\\Desktop\\lvmiao\\py\\runyolo\\camera\\\\\"\n",
    "        self.cameraMatrix=np.loadtxt(root+\"cameraMatrix.txt\",delimiter=',')\n",
    "        self.distCoeffs=np.loadtxt(root+\"distCoeffs.txt\",delimiter=',')\n",
    "        self.x0 = self.cameraMatrix[0, 2]\n",
    "        self.y0 = self.cameraMatrix[1, 2]\n",
    "        self.fx = self.cameraMatrix[0, 0]\n",
    "        self.fy = self.cameraMatrix[1, 1]\n",
    "        self.f = (self.fx + self.fy)/2  # 取x、y方向焦距的平均值\n",
    "        print(self.cameraMatrix)\n",
    "\n",
    "    def get_dist(self, u_vanishing, v_vanishing, uv):\n",
    "        phi=np.arctan((v_vanishing-self.y0)/self.fy)  # 根据消失点坐标求俯仰角和航偏角\n",
    "        omega=np.arctan((self.x0-u_vanishing)*cos(phi)/self.fx)\n",
    "        u, v = self.undistort(uv)  # 畸变校正\n",
    "        u_ = u - self.x0  # 像素坐标（以左上角为原点）转换为像平面坐标（以像主点为原点）\n",
    "        v_ = self.y0 - v\n",
    "        # 以下是用像素坐标（u_,v_）、物方Z=0，代入共线方程求物方坐标X（横向距离）、Y（纵向距离）。\n",
    "        X_temp = cos(omega) * u_ + cos(phi)*sin(omega)*self.f -sin(phi)*sin(omega)*v_\n",
    "        Y_temp = sin(omega) * u_ - cos(phi)*cos(omega)*self.f + sin(phi)*cos(omega)*v_\n",
    "        Z_temp = sin(phi)*self.f + cos(phi)*v_\n",
    "        X = X_temp / Z_temp * (-self.h)\n",
    "        Y = Y_temp / Z_temp * (self.h)  # 这个地方本来也是-h，但是结果不对，可能是我公式哪里推错了……\n",
    "        return X, Y\n",
    "    \n",
    "    def undistort(self, uv):\n",
    "        uv = uv.astype(np.float32)  # 一定要是浮点型\n",
    "        uv_undistort = cv2.undistortPoints(uv.reshape(-1,1,2),self.cameraMatrix,self.distCoeffs).reshape(-1,2)\n",
    "        # **///需要将变换后的点先变化为齐次坐标系，然后还需要乘以相机参数矩阵，才是最终的变化的坐标。**\n",
    "        uv_undistort = np.hstack([uv_undistort,np.ones((uv_undistort.shape[0],1))])\n",
    "        uv_undistort = uv_undistort.dot(self.cameraMatrix)\n",
    "        uv_undistort[:,0] += self.x0\n",
    "        uv_undistort[:,1] += self.y0\n",
    "        return uv_undistort[:,0], uv_undistort[:,1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# IMG_080652_830\n",
    "uv= np.array(\n",
    "[\n",
    "    [228,992],\n",
    "    [558,1074],\n",
    "    [1223,1082],\n",
    "    [1597,1007],  # 4\n",
    "    [434,780],\n",
    "    [690,800],\n",
    "    [1114,799],\n",
    "    [1387,780],  # 8\n",
    "    [760,666],\n",
    "    [1064,665],\n",
    "    [1265,661],\n",
    "    [800,593],  # 12\n",
    "    [1035,591],\n",
    "    [697,548],\n",
    "    [828,545],\n",
    "    [1018,544],  # 16\n",
    "    [1190,589],\n",
    "    [844,515],\n",
    "    [858,493],\n",
    "    [996,493],  # 20\n",
    "    [868,476],\n",
    "    [990,475],\n",
    "    [874,462],\n",
    "    [1063,464],  # 24\n",
    "    [882,451],\n",
    "    [980,450],\n",
    "    [1039,442]\n",
    "],dtype=np.float32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[9.84144281e+02 0.00000000e+00 1.01318779e+03]\n",
      " [0.00000000e+00 9.85342627e+02 5.51985501e+02]\n",
      " [0.00000000e+00 0.00000000e+00 1.00000000e+00]]\n"
     ]
    }
   ],
   "source": [
    "cam = camera(1920, 1086, 81)  # 高度是81cm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "X, Y = cam.get_dist(939,348,uv)  # 在ps里面手动交会出来的消失点坐标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAANMAAAFpCAYAAAAGIR1+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xt0VGWa7/HvkwTCNdyTTggYdAIJIRBCFmBPL8XGpBVZjYCCSo+0oKhj96AiNn2cVptpFC+M2MJB6AE7KksQRcnhIK1cFM8IYoIlQtMhXDIkEglqkEu4JPieP6oSi1AhldRbqZ3i+azFyq5du973qdJf7V27qp4SYwxKqcBFhLoApcKFhkkpSzRMSlmiYVLKEg2TUpZomJSyRMOklCUaJqUs0TApZYmGSSlLokJdAED37t1NUlJSqMtQ6iIFBQXfGGN6+LOtI8KUlJREfn5+qMtQ6iIi8j/+bquHeUpZomFSyhINk1KWaJiUskTDpJQlGialLNEwKWWJhkkpSzRMSlmiYVLKEg2TUpZomGwpeND9z2ljNdc8zVWzgznig65hocLlzLGaa57mqtnBdM+klCUaJqUs0cM8ZUVJ+RnufPYffH02lYiICKZNm8b06dOZOHEihYWFABw7dozOnTvjcoXnIaGGSVkRFSnMu/cqMu8v4MSJEwwZMoTs7GxWrlxZu82MGTPo1KlTCKsMLj3MU1bEd4smM7kjAB07diQ1NZWv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wJZBluyb9BIRSlrTIwzylnEjDpJQlGialLNEwKWWJhkkpSzRMSlmiYVLKEg2TUpb8f58RnIQfcFsgAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 216x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 除了24、27之外都应该在网格线的交点上\n",
    "plt.figure(figsize=(3,6))\n",
    "plt.axis('equal')\n",
    "for i in range(1, 12):\n",
    "    plt.plot([-200, 200], [i*80, i*80],color='orange')\n",
    "plt.plot([-45,-45],[0,900],color='orange')  # 实地测量得到，距离地砖左边缘45cm，方形地砖边长80cm\n",
    "plt.plot([35,35],[0,900],color='orange')\n",
    "plt.plot([-102,-102],[0,900],color='orange')  # 实地测量得到\n",
    "plt.plot([92,92],[0,900],color='orange')  \n",
    "plt.scatter(X,Y,marker=\"+\")\n",
    "\n",
    "for i in range(len(X)):\n",
    "    plt.text(X[i], Y[i], str(i+1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
